// Input: Block 4 person records (Raw)
// Input: HHID_HHSize (created from NSS61_HHSize.do)
// Output: Temp61.dta which is used for table 3 and 4



use "$raw\Block 4_Person records.dta", clear

merge m:1 HHID using "$data\HHID_HHSize.dta"

egen tag = tag(HHID)

rename B4_q5 age
gen working_adult=.
replace working_adult=1 if age>16&age<70&!missing(age)
bys HHID: egen num_working_adults=total(working_adult)


rename B4_q7 gen_edu

gen dependants =hhsize-num_working_adults

**Keeping head of household
keep if B4_q1=="01"

keep HHID gen_edu dependants num_working_adults

save "$data\HHID_edu_dep_adults.dta", replace

